<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="renderer" content="webkit">
<title>高校基本信息</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link rel="stylesheet" href="__PUBLIC__/Teachers/css/reset.css">
<link rel="stylesheet" href="__PUBLIC__/Teachers/css/admin.css">
</head>
<body>
	<input type="hidden" id="navigation" value="1.1"/>
	<input type="hidden" name="indexUrl" id="indexUrl" value="{:U('Teachers/BasicInfo/index')}"/>		
    <input type="hidden" name="setMainUrl" id="setMainUrl" value="{:U('Teachers/BasicInfo/setMain')}"/>
    <input type="hidden" name="updateUrl" id="updateUrl" value="{:U('Teachers/BasicInfo/updateAddress')}"/>		
	<input type="hidden" name="addUrl" id="addUrl" value="{:U('Teachers/BasicInfo/addAddress')}"/>		
	<input type="hidden" name="deleteUrl" id="deleteUrl" value="{:U('Teachers/BasicInfo/deleteAddress')}"/>		
	<div class="content">
			<div class="tab-menu">
				<ul>
					<li class="actived"><a href="{:U('Teachers/BasicInfo/index')}">基础信息</a></li>
					<li ><a href="{:U('Teachers/Details/index')}">高校详情</a></li>
					<li ><a href="{:U('Teachers/Alumni/index')}">知名校友</a></li>
				</ul>
			</div>
			<div class="tab-content">
				<div class="biaoge tab-item actived">
					<h2>
						<img src="__ROOT__{$school_data.logo}" alt="">{$school_data.school_name}
					</h2>
					<div class="biaoge tab-box">
						<div class="title-bar"></div>
						<dl class="clearfix">
							<dt>高校英文名称</dt>
							<dd>{$school_data.aliases}</dd>
							<dt>高校官网地址</dt>
							<dd><a href="{$school_data.website}" target="_blank">{$school_data.website}</a></dd>
							<dt>建校时间</dt>
							<dd class="samll-dd">{$school_data.school_time_year}</dd>
							<volist name="basic_data" id="vo">
							<eq name="vo.school_type_sort" value="4">
								<dt>办学类型</dt>
								<dd class="samll-dd">
									{$vo.school_type_name}
								</dd>
							</eq>
							<eq name="vo.school_type_sort" value="5">
								<dt>院校性质</dt>
								<dd class="samll-dd">
									{$vo.school_type_name}
								</dd>
							</eq>
							<eq name="vo.school_type_sort" value="6">
								<dt >学院类型</dt>
								<dd class="samll-dd">		
									{$vo.school_type_name}
								</dd>
							</eq>
							</volist>
							<dt>院校属性</dt>
								<dd>
								<volist name="basic_data" id="vo">
									<eq name="vo.school_type_sort" value="7">
										<span>{$vo.school_type_name}</span>
									</eq>
								</volist>
							</dd>
							<dt class="addr-dt">学校地址</dt>
							<dd class="addr-dd">
								<ul>
								<volist name="address_data" id="vo">
									<eq name="vo.main" value="1">
										<li>
										<input type="hidden" name="address_id" value="{$vo.address_id}"/>
										<input type="hidden" name="name" value="{$vo.name}"/>
										<input type="hidden" name="school_address" value="{$vo.school_address}"/>
										<input type="hidden" name="zip" value="{$vo.zip}"/>
										<input type="hidden" name="coordinate_x" value="{$vo.coordinate_x}"/>
										<input type="hidden" name="coordinate_y" value="{$vo.coordinate_y}"/>
										<input type="hidden" name="province_id" value="{$vo.province}"/>
										<input type="hidden" name="city_id" value="{$vo.city}"/>
										<input type="hidden" name="county_id" value="{$vo.county}"/>
										<input type="radio" name="school-addr" checked="checked">&nbsp;&nbsp;{$vo.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$vo.province}&nbsp;&nbsp;{$vo.city}&nbsp;&nbsp;{$vo.county}&nbsp;&nbsp;{$vo.school_address} 
										<i><a href="javascript:;" class="btn-addr-main">设为主校区</a>&nbsp;&nbsp;&nbsp;<a href="javascript:;" class="btn-addr-editor">编辑</a>&nbsp;&nbsp;&nbsp;<a href="javascript:;" class="btn-addr-remove">删除</a></i>
										</li>	
									<else/>
										<li>
										<input type="hidden" name="address_id" value="{$vo.address_id}"/>
										<input type="hidden" name="name" value="{$vo.name}"/>
										<input type="hidden" name="school_address" value="{$vo.school_address}"/>
										<input type="hidden" name="zip" value="{$vo.zip}"/>
										<input type="hidden" name="coordinate_x" value="{$vo.coordinate_x}"/>
										<input type="hidden" name="coordinate_y" value="{$vo.coordinate_y}"/>
										<input type="hidden" name="province_id" value="{$vo.province}"/>
										<input type="hidden" name="city_id" value="{$vo.city}"/>
										<input type="hidden" name="county_id" value="{$vo.county}"/>
										<input type="radio" name="school-addr" >&nbsp;&nbsp;{$vo.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{$vo.province}&nbsp;&nbsp;{$vo.city}&nbsp;&nbsp;{$vo.county}&nbsp;&nbsp;{$vo.school_address}
										<i><a href="javascript:;" class="btn-addr-main">设为主校区</a>&nbsp;&nbsp;&nbsp;<a href="javascript:;" class="btn-addr-editor">编辑</a>&nbsp;&nbsp;&nbsp;<a href="javascript:;" class="btn-addr-remove">删除</a></i>
										</li>
									</eq>
								</volist>
								</ul>
									<a href="javascript:;" class="btn-add-addr" id="btn-add-addr">新增地址</a>

							</dd>
						</dl>
					</div>
				</div>
			</div>
	</div>
   	<div id="modal">
   		<div class="modal-overlay"></div>
   		<div class="modal-box" id="modal_address">
   	  		<form action="__URL__/addAddress" method="post" name="" id="form-add">
   	  			<input type="hidden" id="address_id" name="address_id" value="">
   	  			<input type="hidden" id="school_id" name="school_id" value="{$school_data.school_id}">
	            <article class="address">
	                <h2>添加新校区</h2>
	                <div class="addlay">
	                    <div class="formitm clearfix">
	                        <label class="lab">校区名称：</label>
	                        <div class="ipt"><input type="text" class="z-ib" name="name" id="school_name" value="" placeholder="填写新校区名称" /></div>
	                    </div>
	                    <div class="formitm clearfix">
	                        <label class="lab">所在地区：</label>
	                        <div class="ipt">
	                             <select name="province_id" class="f-ib" id="province" ></select>
	                             <select name="city_id" class="f-ib" id="city" ></select>
	                             <select name="county_id" class="f-ib" id="county" ></select> 
	                             <script src="__PUBLIC__/Teachers/js/Area.js"></script>
	                             <script>
	                             	var s=["province","city","county"];
	                             	var opt0 = ["省份","地级市","市、县级市"];
	                             	function _init_area(){ 
	                             		for(i=0;i<s.length-1;i++){
	                             		  document.getElementById(s[i]).onchange=new Function("change("+(i+1)+")");
	                             		}
	                             		change(0);
	                             	}
	                                 _init_area();
	                             </script>   
	                        </div>
	                    </div>
	                    <div class="formitm clearfix">
	                        <label class="lab">详细地址：</label>
	                        <div class="ipt"><input type="text" name="school_address" id="school_address" class="z-ib" value="" placeholder="填写新校区地址"/></div>
	                    </div>
	                    <div class="formitm clearfix">
	                        <label class="lab">校区坐标：</label>
	                        <div class="ipt">
	                        	<input type="text" name="coordinate_x" placeholder="经度坐标" value="" id="coordinate_x" style="width: 90px;">
	                        	<input type="text" name="coordinate_y" placeholder="纬度坐标" value="" id="coordinate_y" style="width: 90px;">
	                        	<a href="javascript:;" id="btn-modal-pos" style="margin-left: 20px;">获取坐标</a>
	                        </div>
	                    </div>
	                    <div class="formitm clearfix">
	                        <label class="lab">邮编：</label>
	                        <div class="ipt"><input type="text" class="f-ib" name="zip" id="school_zipcode" value="" placeholder=""/></div>
	                    </div>
	                    <div class="formitm clearfix">
	                        <label class="lab">电话：</label>
	                        <div class="ipt"><input type="text" class="f-ib" name="phone" id="school_phone" value="" placeholder=""/></div>
	                    </div>
	                    <div class="formitm clearfix">
	                        <div class="lybtns">
	                        	<input type="submit" value="保存" class="u-btn btn-yes">
	                            <button type="button" class="u-btn btn-cancel">取消</button>
	                        </div>
	                    </div>
	                </div>
	            </article>
	   		</form>
	   	</div>
    </div>
    <div id="modal-pos" style="">
        <div class="topbar">
            <div class="search-box2">
                <input type="text" class="search-txt">
                <a href="javascript:;" class="btn-search"> 搜索地址 </a>
            </div> 
            <div id="input-lng">
                <label for="input-lng">经度</label><input type="text">
            </div>
            <div id="input-lat">
                <label for="input-lat">纬度</label><input type="text">
            </div>
            <a href="javascript:;" class="btn-submit-pos"> 提交坐标 </a>
            <a href="javascript:;" class="btn-closed-pos"> X </a>
        </div>
        <div class="map" id="mapA"></div>
    </div>
    <script src="__PUBLIC__/Teachers/js/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=m8ILLqprDCS6rhKqLeSCtdZZ"></script>
	<script src="__PUBLIC__/Teachers/js/admin.js"></script>
    <script>
    	moduleAddress();
    	// 坐标-地图弹窗
        $('#btn-modal-pos').on('click', function(event) {
            if ( $('#modal').is(':hidden')) {
                showModal();
            }
            $('#modal-pos').show();

            // 初始化地图
            var map = new BMap.Map("mapA");
            var point = new BMap.Point(116.331398,39.897445);
            map.centerAndZoom(point,16);
            map.enableScrollWheelZoom(true);
            // 根据浏览器定位 
            var geolocation = new BMap.Geolocation();
            geolocation.getCurrentPosition(function(r){
                if(this.getStatus() == BMAP_STATUS_SUCCESS){
                    map.panTo(r.point);
                }     
            },{enableHighAccuracy: true});
            // 点击搜索
            $('#modal-pos').find('.btn-search').on('click',function(event) {
                var keyword = $(this).prev().val();
                // alert(keyword);
                var local = new BMap.LocalSearch(map, {
                    renderOptions:{map: map}
                });
                local.search(keyword);
            });
            // 点击地图的坐标，返回坐标值
            map.addEventListener("click", function(e){      
                   // alert(e.point.lng + ", " + e.point.lat);
                  $('#input-lng').find('input').val(e.point.lng);
                  $('#input-lat').find('input').val(e.point.lat);
            });
            //点击提交，返回坐标值到原来input框
            $('#modal-pos').find('.btn-submit-pos').on('click',function(e) {
                var lng = $('#input-lng').find('input').val();
                var lat = $('#input-lat').find('input').val();
                $('#modal-pos').hide();

                if ($('#modal-address').is(":hidden")) {
                    $('#tab-item-baseinfo').find('.addr-pos').find('input').eq(0).val(lng);
                    $('#tab-item-baseinfo').find('.addr-pos').find('input').eq(1).val(lat);
                }else{
                    $('#coordinate_x').val(lng);
                    $('#coordinate_y').val(lat);
                }
                if ($('#modal-address').is(":hidden")) {
                    $('#modal').hide();
                    $('#modal .modal-overlay').hide();
                    $('#modal .modal-box').hide();
                    $mask.hide();
                }

            });
            // 点击关闭弹窗
            $('#modal-pos .btn-closed-pos').on('click', function(event) {
                $('#modal-pos').hide();
                if ($('#modal-address').is(":hidden")) {
                    $('#modal').hide();
                    $('#modal .modal-overlay').hide();
                    $('#modal .modal-box').hide();
                    $mask.hide();
                }
            });
        });
    </script>

</body>
</html>